/**
 * Copyright phonemap.com
 *
 * Licensed under the phonemap.com License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.phonemap.com/licenses/LICENSE-1.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.phonemap.dao;

import com.googlecode.objectify.Key;
import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.helper.DAOBase;
import com.phonemap.models.Photo;


/**
 * The Class PhotoDAO.
 */
public class PhotoDAO extends DAOBase {

    static {
        ObjectifyService.register(Photo.class);
    }

    /**
     * Save.
     *
     * @param photo the photo
     * @return the photo
     */
    public Photo save(Photo photo) {
        ofy().put(photo);
        return photo;
    }
    
    /**
     * Find by id.
     *
     * @param id the id
     * @return the photo
     */
    public Photo findById(Long id) {
        Key<Photo> key = new Key<Photo>(Photo.class, id);
        return ofy().get(key);
    }
    
}